﻿using System.Reflection;
using Abp.Modules;
using Abp.Zero;
using Abp.Zero.Configuration;
using RMM.Authorization;
using RMM.Authorization.Roles;
using RMM.Authorization.Tenants;
using RMM.Core.Entity.Users;

namespace RMM
{
    [DependsOn(typeof(AbpZeroCoreModule))]
    public class RMMCoreModule : AbpModule
    {
        public override void PreInitialize()
        {
            Configuration.Auditing.IsEnabledForAnonymousUsers = true;

            //Declare entity types
            Configuration.Modules.Zero().EntityTypes.Tenant = typeof(Tenant);
            Configuration.Modules.Zero().EntityTypes.User = typeof(User);
            Configuration.Modules.Zero().EntityTypes.Role = typeof(Role);



            AppRoleConfig.Configure(Configuration.Modules.Zero().RoleManagement);

            Configuration.Authorization.Providers.Add<RMMAuthorizationProvider>();
            
        }
        public override void Initialize()
        {
            IocManager.RegisterAssemblyByConvention(Assembly.GetExecutingAssembly());
        }
    }
}
